using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Idle_State : Ab_State
{
    private void OnEnable()
    {
        if (isStarted == false) return;
        body.velocity = new Vector3(0, body.velocity.y, 0);
    }
    // Start is called before the first frame update
    protected override void Start()
    {
        base.Start();
        InputActions.Player.Jump.started += (context) =>
        {
            if (!this.gameObject.activeSelf) return;
            animator.SetTrigger("Jump");
        };
    }

    // Update is called once per frame
    void Update()
    {
        if (player.isMoving)
            animator.SetBool("Run", true);
    }

    private void FixedUpdate()
    {
        if (body.velocity.y * player.transform.up.y < -0.5f)
        {
            animator.SetTrigger("Fall");
        }
    }
}
